﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using MVC_Project.Model;
using MVC_Project.Bll.Goods;
using MVC_Project.Api.Models.ManageGoods;

namespace MVC_Project.Api.Areas.Goods
{
    public class GoodTypeController : ApiController
    {
        GoodTypeBll bll = new GoodTypeBll();
        // GET: api/GoodType
        public List<GoodsType> Get()
        {
            var types = bll.Query();

            var data = from t in types
                       select new GoodsType
                       {
                           id=t.id,
                           name=t.name,
                           icon= t.icon,
                           sort = t.sort,
                           is_show_backstage=t.is_show_backstage
                       };

            return data.ToList() ;
        }

        // GET: api/GoodType/5
        public string Get(int id)
        {
            return "value";
        }

        // POST: api/GoodType
        public void Post([FromBody]string value)
        {
        }

        // PUT: api/GoodType/5
        public void Put(int id, [FromBody]string value)
        {
        }

        // DELETE: api/GoodType/5
        public void Delete(int id)
        {
        }
    }
}
